{
    class Loading extends Sail.Scene {
        constructor (data) {
            super();
            
            this.players = null;
            this.tipBox = null;
            this.data = Sail.Utils.extend(true, [], data);

            this.init(data);
        }

        init (data) {
            // data = {"player":[[{"uid":2037586642,"lv":0,"tno":"64959512","ue":"yl*5","mid":2,"um":0,"lr":1,"pos":0,"st":1,"ho":"1","gd":"1","hn":"瑞恩","hl":1,"hm":0,"offplay":0,"bt":0,"maxhp":1000,"hp":1000,"w":120,"h":186,"s":500,"m":0,"d":0,"status":1,"clip":{"max":3,"t":500,"p":{"x":-20,"y":-34,"x1":84,"y1":-56},"s":1000,"n":5,"b":400},"bullet":{"t":1,"s":500,"g":1000,"d":{"h":100,"t":2000,"r":10},"i":{"h":100,"t":2000,"r":10},"b":{"h":100,"t":2000,"r":10}},"cup":0,"camp":"red","x":72,"y":792,"mx":1,"my":0}],[{"uid":2037610954,"lv":2,"tno":"64954277","ue":"qianqian","mid":2,"um":0,"lr":1,"pos":0,"st":1,"ho":"1","gd":"1","hn":"瑞恩","hl":1,"hm":0,"offplay":0,"bt":0,"maxhp":1000,"hp":1000,"w":120,"h":186,"s":500,"m":0,"d":0,"status":1,"clip":{"max":3,"t":500,"p":{"x":-20,"y":-34,"x1":84,"y1":-56},"s":1000,"n":5,"b":400},"bullet":{"t":1,"s":500,"g":1000,"d":{"h":100,"t":2000,"r":10},"i":{"h":100,"t":2000,"r":10},"b":{"h":100,"t":2000,"r":10}},"cup":0,"camp":"blue","x":4968,"y":792,"mx":-1,"my":0}]],"tips":"匹配成功，开始加载","roomNo":"797908acd9"};
            this.players = new Com.Loading.Players(data.player);
            let bg = new Laya.Image("res/loading/bg.jpg");
                bg.scale(2, 2);
                bg.centerX = 0;
                bg.centerY = 0;

            let light = new Laya.Image("res/loading/light.png");
                light.x = 543;
                light.centerY = 0;

            this.bg = bg;
            this.light = light;
            this.addChildren(bg, light, this.players);

            this.addTips(data.tips);
        }

        addTips (msg) {
            let tipBox = new Laya.Box();
                tipBox.size(GAME_CONFIG.WIDTH, 50);
                tipBox.bottom = 0;

            let tipBG = new Laya.Sprite();
                tipBG.graphics.drawRect(0, 0, tipBox.width, tipBox.height, "#212121");
                tipBG.alpha = 0.7;

            let tip = new Laya.Label(msg);
                tip.fontSize = 18;
                tip.color = "#a18561";
                tip.align = "center";
                tip.size(tipBox.width - 100, 22);
                tip.centerX = 0;
                tip.centerY = 0;

            tipBox.addChildren(tipBG, tip);
            this.tipBox = tipBox;
            this.addChild(tipBox);
        }

        onEnter () {
            Laya.loader.load(ASSETS.GAME, Laya.Handler.create(this, function () {
                let game = new Scene.Game();
                game.init(this.data);
                Sail.director.runScene(game);
            }), Laya.Handler.create(this, function (val) {
                Sail.io.emit("loading", {p : val * 100 | 0});
            }, null, false));
        }
    }

    Sail.class(Loading, "Scene.Loading");
}